<?php

// 时间
// date_default_timezone_set('prc');//设置时区，如果不设置会差8小时
// echo date('Y-m-d H:i:s', time());
// var_dump(phpinfo());


// 数据库
class Model{

	protected $server;
	protected $name;
	protected $pass;
	protected $db_name;
	protected $conn;

	public function __construct($arr = [])
	{
		$this->server = $arr['server'];
		$this->name = $arr['name'];
		$this->pass = $arr['pass'];
		$this->db_name = $arr['db_name'];

		$this->conn = new mysqli($this->server, $this->name, $this->pass, $this->db_name);
		if($this->conn->connect_error){
			die("连接失败". $this->conn->error);
		}else{
			echo "连接成功";
		}
	}

	public function __destruct() 
	{
		$this->conn->close();
	}

	public function select($sql)
	{
		$res = [];
		$result = $this->conn->query($sql);
		if($result->num_rows > 0){
			while ($row = $result->fetch_assoc()) {
				array_push($res, $row);
			}
		}
		return $res;
	}
}

$one = 1;

$two = &$one;

$two = 2;

echo $one;